package androidgame.teslawars.game;

import androidgame.teslawars.game.Level.Player;


public abstract class Unit {
	
	public enum UnitName { TANK, JET, FOOTSOLDIER };
	
	int health;
	int armor; 
	int moveRange;
	int attackRange; 
	int attackDamage;
	UnitName unitName;
	int x;
	int y;
	boolean canMove;
	boolean canAttack;
	Player player;
	
	public abstract int attack(Unit target);
	
	public abstract int moveCost(Tile tile);
	
	public abstract int getBonusDefenseValue(Tile tile);
	
	@Override 
	public String toString() {
		StringBuilder builder = new StringBuilder();
		
		builder.append(unitName.toString());
		builder.append(": ");
		builder.append("Health =");
		builder.append(health);
		builder.append(" Armor =");
		builder.append(armor);
		builder.append(" Move Range =");
		builder.append(moveRange);
		builder.append(" Attack Range =");
		builder.append(attackRange);
		builder.append(" Attack Damage =");
		builder.append(attackDamage);
		builder.append(" Position =");
		builder.append(x);
		builder.append(",");
		builder.append(y);
		builder.append(" Move =");
		builder.append(canMove);
		builder.append(" Attack =");
		builder.append(canAttack);
		builder.append(" Player =");
		builder.append(player);
		
		return builder.toString();		
	}	
	
	public int getX() {
		return x;
	}
	
	public int getY() {
		return y;
	}

	public int getHealth() {
		return health;
	}

	public int getArmor() {
		return armor;
	}

	public int getMoveRange() {
		return moveRange;
	}

	public int getAttackRange() {
		return attackRange;
	}

	public int getAttackDamage() {
		return attackDamage;
	}

	public UnitName getUnitName() {
		return unitName;
	}

	public boolean isCanMove() {
		return canMove;
	}

	public boolean isCanAttack() {
		return canAttack;
	}

	public Player getPlayer() {
		return player;
	}
	
}
